import React,{useState,useCallback} from 'react'
import Son from './Son';

export default function useCallbackDemo() {
    
  //  定义状态
  const [age,setAge] = useState(12);
  const [price,setPrice] = useState(15);
 
  function changeAge(){    
    setAge(age+1);
  }
 
  return (
    <>
      <div>useMemo</div>
      <p>age:{age}</p>
      <input type="button" value="修改age" onClick={changeAge} />
      
      <p>price:{price}</p>
      <input type="button" value="修改Price" onClick={()=>setPrice(price+2)} />
      
      <Son count={age} price={price} ></Son>
    </>
  )
}

